<?php

use yii\helpers\Html;
use yii\widgets\LinkPager;

/* @var $this yii\web\View */

$this->title = '我的收藏';
$this->params['breadcrumbs'][] = $this->title;
?>
<table class="table">
    <h3>我的收藏</h3>
    <tbody>
        <?php if ($collect_list): ?>
            <?php foreach ($collect_list as $row): ?>
                <tr>
                    <td class="w50"><div class="<?php echo $row->article->comments ? 'answers' : 'no-answers' ?>"><?php echo $row->article->comments; ?><small>回答</small></div></td>
                    <td class="w50"><div class="views"><?php echo $row->article->view; ?><small>浏览</small></div></td>
                    <td>
                        <span><?php echo $row->article->author->username ?> &nbsp;&nbsp;<?php echo Yii::$app->formatter->asRelativeTime($row->article->created_at) ?>&nbsp;发布</span><br>
                        <a href="/qa/view?id=<?php echo $row->article->id ?>"><?php echo $row->article->title; ?></a>
                        <?php foreach ($row->article->tags($row->article->id) as $item): ?>
                            <a class="btn btn-success btn-xs" href="/tags/show?id=<?php echo $item->id ?>" role="button"><?php echo $item->name ?></a>
                        <?php endforeach; ?>
                    </td>
                </tr>
            <?php endforeach; ?>
        <?php else: ?>
        <p class="text-warning">你当前还没有任何收藏</p>
    <?php endif; ?>
</tbody>
</table>
<?php
echo LinkPager::widget(['pagination' => $pages]); // 显示分页?>